package com.cmpe451.nutty.utils;

import javax.servlet.http.HttpServletResponse;

public class JsonResponseException extends RuntimeException {
	private static final long serialVersionUID = 1L;

	private int httpStatus;
	private int errorCode;

	public JsonResponseException(int errorCode, String message, int httpStatus) {
		super(message);
		this.setHttpStatus(httpStatus);
		this.errorCode = errorCode;
	}

	public JsonResponseException(String message, int httpStatus) {
		this(ErrorCode.E_INTERNAL_SERVER_ERROR, message, httpStatus);
	}

	public JsonResponseException(int errorCode, String message) {
		this(errorCode, message, HttpServletResponse.SC_BAD_REQUEST);
	}

	public JsonResponseException(String message) {
		this(message, HttpServletResponse.SC_BAD_REQUEST);
	}

	public int getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(int errorCode) {
		this.errorCode = errorCode;
	}

	public int getHttpStatus() {
		return httpStatus;
	}

	public void setHttpStatus(int httpStatus) {
		this.httpStatus = httpStatus;
	}

}
